<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	FaqForm form = (FaqForm)request.getAttribute("command");
	List<TblOaFaq> list = (List<TblOaFaq>)request.getAttribute("list");
	
	String faqClass = (null!=form.getFaqClass())?form.getFaqClass():"";
	String faqQuestion = (null!=form.getFaqQuestion())?form.getFaqQuestion():"";
	String publicMan = (null!=form.getPublicMan())?form.getPublicMan():"";
	String createDateBegin = (null!=form.getCreateDateBegin())?form.getCreateDateBegin():"";
	String createDateEnd = (null!=form.getCreateDateEnd())?form.getCreateDateEnd():"";
%>

<div class="userListWrap">
	<form id="faqListForm">
		<div class="form-item">
			<label for="faqQuestion">标题</label> <input class="easyui-validatebox"
				type="text" name="faqQuestion" data-options=""
				value="<%=faqQuestion %>" />
		</div>
		<div class="form-item">
			<label for="faqClass">分类:</label> <select name="faqClass"
				form="faqClass">
				<option value="">全部</option>
				<option value="常见问题"
					<%=faqClass.equalsIgnoreCase("常见问题")?"selected=selected":""%>>常见问题</option>
				<option value="服务指南"
					<%=faqClass.equalsIgnoreCase("服务指南")?"selected=selected":""%>>服务指南</option>
			</select>
		</div>
		<div class="form-item">
			<label for="publicMan">发布人</label> <input class="easyui-validatebox"
				type="text" name="publicMan" data-options="" value="<%=publicMan %>" />
		</div>
		<div class="form-item form-item-two">
			<label>创建时间:</label> <input id="createDateBegin"
				name="createDateBegin" type="text" class="easyui-datebox">--
			<input id="createDateEnd" name="createDateEnd" type="text"
				class="easyui-datebox">
		</div>

		<div class="form-item form-item">
			<a href="javascript:XF.Faq.listFaqSearch()"
				class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
		</div>
	</form>
	

	<table id="faqListTable" class="easyui-datagrid" title="">
		<thead>
			<tr>
				<th
					data-options="field:'select',width:80,align:'center',checkbox:'true'"><input
					type="checkbox"></th>
				<th data-options="field:'faqClass',width:100"
					orderByField='faqClass'><a class="order-field"
					href="javascript:XF.Faq.listFaqSearch('faqClass')">FAQ类型</a> <%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("faqClass".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span> <%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span> <%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span> <%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span> <%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span> <%
						}
					%></th>
				<th data-options="field:'faqQuestion',width:310"
					orderByField='faqQuestion'>说明标题<%-- <a class="order-field"
					href="javascript:XF.Faq.listFaqSearch('faqQuestion')">说明标题</a> <%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("faqQuestion".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span> <%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span> <%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span> <%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span> <%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span> <%
						}
					%> --%></th>
				<th data-options="field:'publicMan',width:100"
					orderByField='publicMan'><a class="order-field"
					href="javascript:XF.Faq.listFaqSearch('publicMan')">发布人</a> <%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("publicMan".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span> <%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span> <%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span> <%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span> <%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span> <%
						}
					%></th>
				<th data-options="field:'publicTime',width:150"
					orderByField='publicTime'><a class="order-field"
					href="javascript:XF.Faq.listFaqSearch('publicTime')">发布时间</a> <%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
							if("publicTime".equalsIgnoreCase(form.getOrderByField())){
								if("asc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px t" orderByMode='desc'>&nbsp;</span> <%
								}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
									%><span class="px d" orderByMode='asc'>&nbsp;</span> <%
								}else{
									%><span class="px" orderByMode='asc'>&nbsp;</span> <%
								}
							}else{
								%><span class="px" orderByMode='asc'>&nbsp;</span> <%
							}
						}else{
							%><span class="px" orderByMode='asc'>&nbsp;</span> <%
						}
					%></th>
				<th data-options="field:'faq',width:100">操作</th>
			</tr>
		</thead>
		<tbody>
			<%
				if(!CollectionUtils.isEmpty(list)){
					for(TblOaFaq faq:list){
						%>
			<tr s="<%=faq.getFaqId() %>">
				<td></td>
				<td><%=faq.getFaqClass() %></td>
				<td><%=faq.getFaqQuestion() %></td>
				<td><%=faq.getPublicMan() %></td>
				<td><%=null!=faq.getPublicTime()?DateFormatUtils.format(faq.getPublicTime().getTime(), "yyyy-MM-dd"):"" %></td>
				<td>
					<a class="inLink" href="javascript:XF.Faq.editFaq('<%=faq.getFaqId() %>')"><span>编辑</span></a>
					<a href="javascript:XF.Faq.deleteFaq('<%=faq.getFaqId() %>')"><span>删除</span></a>				
				</td>

			</tr>
			<%
					}
				}
			
			%>
		</tbody>
	</table>
	<div class="pagination paginationFixWidth">
		<monggoTag:pagination href="listFaq_search"
			pageSize="<%=form.getPageSize()%>"
			totalRecord="<%=form.getTotalRecord() %>"
			currentPage="<%=form.getPageNum() %>">
		</monggoTag:pagination>
	</div>
</div>


<script type="text/javascript">
$('#faqListTable').datagrid(); 
$("#createDateBegin").datebox({
	formatter:XF.dateFormatter,
	parser:XF.dateParse
});

$("#createDateEnd").datebox({
	formatter:XF.dateFormatter,
	parser:XF.dateParse
});

	
</script>
</html>